package com.objecteffects.ilmp.tumblr.method;

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import com.objecteffects.ilmp.tumblr.method.Avatar.AvatarResponse;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * @author Rusty Wright
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@JsonPropertyOrder({
    "meta", "response"
})
public class Avatar extends BaseResponse<AvatarResponse> {
    /**
     * @param meta
     * @param response
     */
    public Avatar(@JsonProperty("meta")
    final Meta meta, @JsonProperty("response")
    final AvatarResponse response) {
        super(meta, response);
    }

    @JsonInclude(JsonInclude.Include.ALWAYS)
    public static class AvatarResponse {
        private final String avatarUrl;

        @JsonCreator
        public AvatarResponse(@JsonProperty("avatar_url")
        final String _avatarUrl) {
            this.avatarUrl = Objects.requireNonNull(_avatarUrl);
        }

        @JsonProperty("avatar_url")
        public String getAvatarUrl() {
            return this.avatarUrl;
        }

        @Override
        public String toString() {
            return ToStringBuilder.reflectionToString(this);
        }

        @Override
        public int hashCode() {
            return HashCodeBuilder.reflectionHashCode(this);
        }

        @Override
        public boolean equals(final Object other) {
            return EqualsBuilder.reflectionEquals(this, other);
        }
    }
}
